package com.jeffse.light.stream.core.data.state;

import com.jeffse.light.stream.core.data.descriptor.stateDescriptor.ListStateDescriptor;
import net.sf.ehcache.Element;

import java.util.List;

/**
 * List 类型state
 * @param <T>
 */
public class ListState <T> extends State {
    public ListState(ListStateDescriptor stateDescriptor){
        super();
        this.stateDescriptor = stateDescriptor;
    }

    public List<T> getList(){
        Element element = backends.getState(stateDescriptor);
        if (element != null){
            return (List<T>)element.getObjectValue();
        }
        return null;
    }

}
